<?php
/*
 * @ https://EasyToYou.eu - IonCube v11 Decoder Online
 * @ PHP 7.2 & 7.3
 * @ Decoder version: 1.1.6
 * @ Release: 10/08/2022
 */

// Decoded file for php version 71.
namespace longbingcore\wxcore;
class aliyun
{
    public static function main($uniacid, $phone, $type = 1)
    {
        $client = self::createClient($uniacid);
        $config_model = new \app\reminder\model\Config();
        $config = $config_model->dataInfo(["uniacid" => $uniacid]);
        if ($type == 1) {
            $tmpl_id = $config["reminder_tmpl_id"];
        } elseif ($type == 2) {
            $tmpl_id = $config["help_tmpl_id"];
        } else {
            $tmpl_id = $config["order_end_tmpl_id"];
        }
        $singleCallByTtsRequest = new \AlibabaCloud\SDK\Dyvmsapi\V20170525\Models\SingleCallByTtsRequest(["calledNumber" => $phone, "ttsCode" => $tmpl_id, "calledShowNumber" => $config["reminder_public"] == 0 ? $config["reminder_phone"] : ""]);
        $runtime = new \AlibabaCloud\Tea\Utils\Utils\RuntimeOptions([]);
        try {
            $res = $client->singleCallByTtsWithOptions($singleCallByTtsRequest, $runtime);
            $res = object_array($res);
            return !empty($res["body"]) ? $res["body"] : [];
        } catch (\Exception $error) {
            if (!$error instanceof \AlibabaCloud\Tea\Exception\TeaError) {
                $error = new \AlibabaCloud\Tea\Exception\TeaError([], $error->getMessage(), $error->getCode(), $error);
            }
            \AlibabaCloud\Tea\Utils\Utils::assertAsString($error->message);
        }
    }

    public static function createClient($uniacid)
    {
        $configmodel = new \app\massage\model\Config();
        $config = $configmodel->dataInfo(["uniacid" => $uniacid]);
        $accessKeyId = trim($config["short_id"]);
        $accessKeySecret = trim($config["short_secret"]);
        $config = new \Darabonba\OpenApi\Models\Config(["accessKeyId" => $accessKeyId, "accessKeySecret" => $accessKeySecret]);
        $config->endpoint = "dyvmsapi.aliyuncs.com";
        return new \AlibabaCloud\SDK\Dyvmsapi\V20170525\Dyvmsapi($config);
    }
}

?>